Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: Telephony /
Chapter 3 - Directory Numbers


Using Directory Numbers

You can use the Telephone Manager to find the directory number or numbers associated with a telephone terminal, get information about directory numbers, set some of the features of a directory number, and manage the sound stream associated with a directory number. This section describes how to perform some of these tasks.

Finding Directory Numbers

A telephone terminal is associated with one or more directory numbers. You can find out how many directory numbers are associated with a specific terminal by calling the TELCountDNs function. Then you can use the TELDNLookupByIndex or TELDNLookupByName function to find a particular directory number. If you need to find a directory number having specific features, you can inspect the feature flags and the forwarding flags of a directory number. Listing 3-1 illustrates how to find a directory number that can initiate outgoing calls. If no such directory number can be found, the function MyGetOutgoingDN returns nil.

Listing 3-1 Finding a directory number that can place outgoing calls

TELDNHandle MyGetOutgoingDN (TELHandle myTerm)
{
   TELDNHandle myTELDN = nil;
   short       myCount;
   TELErr      myErr;

   myCount = TELCountDNs(myTerm, telAllDNs, true);
   for (myIndex = 1; myIndex <= myCount; myIndex++) {
      myErr = TELDNLookupByIndex(myTerm, telAllDNs, true, myIndex, myTELDN);
      if (myTELDN != nil) {
         if ((*myTELDN)->featureFlags && canInitiate) {
            return(myTELDN);
         } else {
            myTELDN = nil;
         }
      }
   }

   return(myTELDN);
}
The MyGetOutgoingDN function defined in Listing 3-1 inspects the feature flags of each available directory number and returns a handle to the first one that can initiate outgoing calls.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 DEC 1996



Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help